package week_02.full_replacement;

import java.util.ArrayList;
import java.util.Arrays;

public class full_replacement {
    public static void main(String[] args) {
        int[] a={1,2,3,4};
        repalce(a,0,3);
    }
    public static void repalce(int[] a,int s,int e){
        if (s==e){
            System.out.println(Arrays.toString(a));
        }else {
            for (int i=0;i<=e;i++){
                swap(a,s,i);
                repalce(a, s + 1, e);
                swap(a,s,i);
            }
        }
    }
    public static void swap(int[] a, int i, int j) {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    }
}